<#systemSituation globalInfo="${globalInfo}"/>

<!-- widget grid with search -->
<section>

    <!-- row -->
    <div class="row">

        <!-- NEW WIDGET START -->
        <article class="col-xs-12 col-sm-12 col-md-12 col-lg-12">

            <div class="jarviswidget jarviswidget-color-blueDark" data-widget-editbutton="false">
                <header>
                    <span class="widget-icon"> <i class="fa fa-table"></i> </span>

                    <h2>全局报表 </h2>

                </header>

                <div>

                    <!-- widget edit box -->
                    <div class="jarviswidget-editbox">
                        <!-- This area used as dropdown edit box -->
                    </div>
                    <!-- end widget edit box -->
                    <!-- widget content -->
                    <div class="widget-body no-padding">

                        <button id="dynamicPDF" class="btn btn-info"> 后台动态生成方式</button>

                        <button id="directPDF" class="btn btn-primary"> 直接调用PDF方式</button>

                    </div>

                </div>
            </div>

        </article>
        <!-- WIDGET END -->
    </div>
    <!-- end row -->
</section>
<!-- end widget grid with search -->

<script type="text/javascript">

    /* DO NOT REMOVE : GLOBAL FUNCTIONS!
     *
     * pageSetUp(); WILL CALL THE FOLLOWING FUNCTIONS
     *
     * // activate tooltips
     * $("[rel=tooltip]").tooltip();
     *
     * // activate popovers
     * $("[rel=popover]").popover();
     *
     * // activate popovers with hover states
     * $("[rel=popover-hover]").popover({ trigger: "hover" });
     *
     * // activate inline charts
     * runAllCharts();
     *
     * // setup widgets
     * setup_widgets_desktop();
     *
     * // run form elements
     * runAllForms();
     *
     ********************************
     *
     * pageSetUp() is needed whenever you load a page.
     * It initializes and checks for all basic elements of the page
     * and makes rendering easier.
     *
     */
    pageSetUp();

    /*
     * ALL PAGE RELATED SCRIPTS CAN GO BELOW HERE
     */
    // PAGE RELATED SCRIPTS
    // pagefunction
    var pagefunction = function () {

        // 发送请求到后台,后台生成pdf展示的方式
        $('#dynamicPDF').on('click', function () {

            // encodeURIComponent();
            var url = "/tools/report/preview";
            var params = JSON.stringify({type: "line", title: '用户', legends: ['上行流量', '下行流量']});
            var base64 = true;
            var res = '?url=' + encodeURIComponent(url) + '&params=' + Base64.encode(params) + '&base64=' + base64;
            layer.open({
                type: 2,
                title: 'PDF信息',
                shadeClose: false,
                btn: ['关闭'],
                shade: false,
                maxmin: true, //开启最大化最小化按钮
                area: ['960px', '640px'],
                content: '${ctx}/tools/pdf' + res
            });
        });

        // 直接申请后台pdf文件的方式
        $('#directPDF').on('click', function () {
            var url = "tmp/generate/Guacamole桌面虚拟化介绍和安装使用.pdf";
            var params = "";
            var base64 = false;
            var res = '?url=' + encodeURIComponent(url) + '&params=' + params + '&base64=' + base64;
            layer.open({
                type: 2,
                title: 'PDF信息',
                shadeClose: false,
                btn: ['关闭'],
                shade: false,
                maxmin: true, //开启最大化最小化按钮
                area: ['960px', '640px'],
                content: '${ctx}/tools/pdf' + res
            });
        });

    };

    // destroy generated instances
    // pagedestroy is called automatically before loading a new page
    // only usable in AJAX version!
    var pagedestroy = function () {
    };
    // end destroy

    // load related plugins
    loadScript("/static/js/plugin/datatables/jquery.dataTables.js", function () {
        loadScript("/static/js/plugin/datatables/dataTables.colVis.js", function () {
            loadScript("/static/js/plugin/datatables/dataTables.tableTools.js", function () {
                loadScript("/static/js/plugin/datatables/dataTables.bootstrap.js", function () {
                    loadScript("/static/js/plugin/datatable-responsive/datatables.responsive.js", function () {
                        loadScript("/static/js/plugin/base64/base64.js");
                        loadScript("/static/js/extend/DataTableData.js", pagefunction);
                    });
                });
            });
        });
    });

</script>